package org.cainiao.basic.reactive.threading_cheduler;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;

public class PublishOnTest {

    public static void main(String[] args) {
        test();
    }

    public static void test() {
        Scheduler s = Schedulers.newParallel("parallel-scheduler", 4);
        final Flux<String> flux = Flux
            .range(1, 2)
            .map(i -> 10 + i)
            .publishOn(s)
            .map(i -> "value " + i);
        new Thread(() -> flux.subscribe(System.out::println));
    }

}
